$border-radius: 10px;
$border: 1px solid #dcdfe6;
$table-border: 1px solid #dcdfe6;
$padding-width: 10px;
$margin-width: 10px;

/* 页面基础布局 */
.page-content {
  padding: $padding-width $padding-width;
  height: 100%;
  display: flex;
  flex-direction: column;
  .el-card {
    border: none;
    border-radius: $border-radius;
    height: 100%;
    .el-card__header {
      border-bottom: none;
      padding-bottom: 0 !important;
    }
    .el-card__body {
      padding-left: 15px !important;
      padding-right: 15px !important;
      overflow-y: auto;
      height: 100%;
      &:has(.el-pagination) {
        height: calc(100% - 47px);
      }
    }
    &:has(.el-card__header) {
      .el-card__body {
        height: calc(100% - 47px);
      }
    }
  }
  & > .el-row {
    height: calc(100% - 74px);
  }
  .page-box {
    height: 100%;
    overflow: auto;
  }
}

/** 页面标题样式 */
.page-title {
  font-family: Source Han Sans CN;
  font-weight: 700 !important;
  font-size: 15px !important;
  color: #191e26;
  display: flex;
  align-items: center;
  margin-bottom: 10px;
  &:before {
    content: '';
    display: inline-block;
    width: 4px;
    height: 14px;
    background: linear-gradient(180deg, #41a8ee 0%, #588ce6 100%);
    border-radius: 3px;
    margin-right: 6px;
  }
}

/* 主页面左右结构*/
.page-left {
  margin-bottom: $margin-width;
  .el-card {
    height: 100%;
    .el-card__body {
      height: 100%;
    }
  }
  @media only screen and (min-width: 1200px) {
    margin-bottom: 0;
    padding-right: 0 !important;
  }
}
.page-right {
  display: flex !important;
  flex-direction: column;
  height: 100%;
}

@mixin form($width: 271px) {
  .el-form-item {
    margin-right: 0px;
    margin-bottom: 15px;
    align-items: center;
    &:not(.search-btn) {
      border: $border;
      border-radius: 4px;
      width: $width;
      background-color: #fff;
      &:has(.el-input.is-disabled),
      &:has(.el-select__wrapper.is-disabled),
      &:has(.el-textarea.is-disabled),
      &:has(.el-radio.is-disabled) {
        background-color: #f5f7fa;
        .el-form-item__label {
          cursor: not-allowed;
        }
      }
      &:hover {
        border-color: #c0c4cc;
      }
      &.is-error {
        border-color: #f56c6c;
      }
      .el-form-item__label {
        padding: 0 5px;
        display: flex;
        justify-content: center;
        align-items: center;
        min-width: 72px;
        white-space: nowrap;
        position: relative;
        font-family: Source Han Sans CN;
        font-weight: 400;
        &::after {
          position: absolute;
          right: 0;
          content: '';
          width: 1px;
          height: 15px;
          background-color: #dcdfe6;
        }
      }
      .el-select__wrapper,
      .el-input__wrapper,
      .el-textarea__inner {
        --el-input-text-color: #898989;
        box-shadow: none !important;
        padding: 1px 6px;
        &:hover {
          box-shadow: none;
        }
      }
      .el-select {
        width: 100%;
        .el-input {
          .el-input__wrapper {
            box-shadow: none !important;
          }
        }
      }
      .el-textarea__inner {
        resize: none;
      }
      .el-input-number {
        width: 100%;
        .el-input__inner {
          text-align: left;
        }
      }
      .el-input-group__append,
      .el-input-group__prepend {
        box-shadow: none;
      }
      .el-input-group__prepend {
        margin-left: 10px;
      }
      .el-radio-group {
        padding-left: 6px;
      }
    }
    @for $i from 1 through 15 {
      &.min-rows-#{$i} {
        min-height: #{21 * $i + 12}px;
      }
      &.max-rows-#{$i} {
        max-height: #{21 * $i + 12}px;
        overflow: auto;
      }
    }
  }
  .form-item-inner {
    .el-form-item__content {
      padding: 10px;
    }
  }
}

/** 设置全局placeholder样式 */
.el-date-editor .el-range-separator,
.el-select__placeholder.is-transparent,
::placeholder {
  color: rgba(25, 30, 38, 0.2) !important;
}

/* 通用查询条件布局*/
.page-search {
  border: none;
  border-radius: $border-radius;
  background-color: #ffff;
  border-radius: $border-radius;
  margin-bottom: $margin-width;
  padding: 15px 15px 7px 15px;
  &:hover {
    box-shadow: 0px 0px 6px rgba(0, 0, 0, 0.12);
  }
  @include form();
  .el-form-item {
    margin-bottom: 8px;
    margin-right: 8px !important;
  }
  & + .el-card {
    flex: 1;
    // overflow: auto;
  }
  .el-select__selected-item {
    .el-tag {
      max-width: 110px !important;
    }
  }
}

/* 通用表格布局 */
.page-table {
  border: $table-border !important;
  border-bottom: none !important;
  &.el-table {
    --el-table-border-color: #dcdfe6;
    height: 100%;
  }
  &:has(+ .pagination-container) {
    height: calc(100% - 47px);
  }
  &.el-table--border {
    .el-table__border-left-patch {
      width: 0;
    }
    .el-table__cell {
      border-right: none;
    }
    .el-table__inner-wrapper:after {
      height: 0;
    }
    &::before,
    &::after {
      width: 0;
      background-color: transparent;
    }
  }
  &.el-table .el-table__header-wrapper th,
  &.el-table .el-table__fixed-header-wrapper th {
    background-color: #e1ebfb !important;
    &:not(:last-child) {
      border-right: 1px solid #dcdfe6;
    }
  }
  .el-table__header .is-group {
    tr:not(:first-child) {
      th {
        border-right: 1px solid #dcdfe6;
      }
    }
    th {
      border-bottom: 1px solid #dcdfe6;
    }
  }
  .el-table__inner-wrapper::before {
    height: 0;
  }
  &.el-table .el-table__cell {
    padding: 7px 0;
    .cell {
      line-height: 16px;
      padding: 0 4px;
      .el-switch {
        height: auto;
      }
    }
  }
  &.el-table td.el-table__cell {
    &:not(:last-child) {
      border-right: $table-border;
    }
  }
  .el-table__empty-block {
    border-bottom: $table-border;
  }
  tr:nth-child(2n) {
    background: #fbfcff;
  }
  .el-form-item {
    margin-bottom: 0 !important;
  }
}

/** 编辑表格样式 */
.edit-table {
  --el-input-height: 28px;
  --el-component-size: 28px;
  &.el-table .el-table__cell {
    padding: 4px 0;
  }
  .el-form-item {
    margin-right: 0 !important;
  }
  .el-input {
    width: 100% !important;
  }
  .el-select__wrapper {
    padding: 1px 11px;
    min-height: var(--el-input-height);
  }
  .el-select__wrapper,
  .el-input__inner {
    font-size: 12px;
  }
  .el-input-number {
    width: 100%;
    .el-input__inner {
      text-align: left;
    }
    &.is-controls-right .el-input__wrapper {
      padding-left: 6px;
    }
  }

  &.no-border {
    .el-select__wrapper,
    .el-input__wrapper {
      padding: 1px 5px;
    }
    .el-select__selection.is-near {
      margin-left: -2px;
    }
    .el-select__wrapper:not(.is-hovering),
    .el-input__wrapper {
      box-shadow: none;
      background-color: transparent;

      &:hover {
        box-shadow: 0 0 0 1px var(--el-input-hover-border) inset;
      }
      &.is-focus {
        box-shadow: 0 0 0 1px var(--el-input-focus-border-color) inset;
      }
    }
    .el-input-number {
      [class*='el-input-number__'] {
        display: none;
      }
      &:hover {
        [class*='el-input-number__'] {
          display: block;
        }
      }
    }
    .el-select {
      .el-select__icon {
        display: none;
      }
      &:hover {
        .el-select__icon {
          display: block;
        }
      }
    }
  }
}

/* 弹窗布局 */
.el-dialog:not(.reset-dialog) {
  background-image: url('@/assets/images/dialog.jpg');
  background-size: 100%;
  background-repeat: no-repeat;
  border-radius: 12px;
  overflow: hidden;
  @include form(auto);
  .el-dialog__header {
    font-weight: 700;
    .el-dialog__headerbtn {
      background: #409eff;
      width: 78px;
      height: 80px;
      border-radius: 50%;
      right: -39px;
      top: -40px;
      &:hover {
        opacity: 0.9;
      }
      .el-dialog__close {
        position: absolute;
        left: 16px;
        bottom: 17px;
        width: 13px;
        height: 13px;
        background-image: url('@/assets/images/close.svg');
        background-size: cover;
        svg {
          display: none;
        }
      }
    }
  }
  .el-form {
    .el-row {
      .el-col {
        padding-left: 8px;
        padding-right: 8px;
      }
    }
  }
  .el-dialog__body {
    padding: 0 15px 2px;
    &:has(.el-form) {
      padding-left: 7px;
      padding-right: 7px;
      & > div {
        padding-left: 7px;
        padding-right: 7px;
      }
    }
  }
  .el-dialog__footer {
    padding-top: 5px;
    .dialog-footer {
      display: flex;
      justify-content: center;
    }
  }
}

.el-dialog {
  &.no-footer {
    .el-dialog__body {
      padding: 15px;
    }
  }
}

@mixin setDialogWidth($width) {
  .el-overlay-dialog {
    .el-dialog:not(.is-fullscreen) {
      width: $width;
    }
  }
}

/* 自定义弹窗宽度60%~90% */
.el-dialog {
  @for $i from 6 through 9 {
    &.w-#{$i} {
      width: #{10 * $i + '%'} !important;
    }
  }
}

@media screen and (min-width: 1200px) {
  .el-dialog {
    min-width: 560px;
  }
}

@media screen and (max-width: 1200px) {
  @include setDialogWidth(60%);
  .el-dialog.w-7 {
    width: 80% !important;
  }
  .el-dialog.w-8 {
    width: 90% !important;
  }
}

@media screen and (max-width: 992px) {
  @include setDialogWidth(80%);
  .el-dialog.w-9 {
    width: 90% !important;
  }
}

@media screen and (max-width: 768px) {
  @include setDialogWidth(90%);
}

/* 抽屉布局 */
.el-drawer {
  background-image: url('@/assets/images/dialog.jpg');
  background-size: 100%;
  background-repeat: no-repeat;
  overflow: hidden;
  @include form(auto);
}
/* 自定义布局，当主题为上下结构，即theme-top */
.topWrapper {
  background-color: #f8f8f8;
  .top-navbar {
    position: fixed;
    width: 100%;
    height: 60px;
    left: 0;
    right: 0;
    background-image: url('@/assets/images/navbar.png');
    background-size: cover;
    background-repeat: no-repeat;
    z-index: 1;
  }
  .sidebar-container {
    box-shadow: none !important;
    background-color: transparent !important;
    & > .theme-top {
      margin-top: $margin-width;
      background-color: #fff;
      height: calc(100% - 80px) !important;
      border-radius: $border-radius;
      &:hover {
        box-shadow: 0px 0px 6px rgba(0, 0, 0, 0.12);
      }
    }
    .el-sub-menu.is-active {
      & > .el-sub-menu__title {
        background-image: url('@/assets/images/menu-active.png');
        background-size: cover;
        background-repeat: no-repeat;
        .menu-title {
          color: #409eff;
        }
        svg {
          color: #409eff;
        }
      }
    }
  }
  .el-menu--vertical {
    .el-menu-item:not(.submenu-title-noDropdown) {
      .svg-icon {
        display: none;
      }
      &::before {
        content: '';
        display: inline-block;
        border-radius: 50%;
        width: 10px;
        height: 10px;
        margin-left: 8px;
        margin-right: 8px;
      }
      &.is-active::before {
        background: linear-gradient(180deg, #2087ee 0%, #406eeb 100%);
      }
    }
  }
  .sidebar-logo-container {
    background-color: transparent !important;
    .sidebar-title {
      color: #fff !important;
    }
  }
  .el-breadcrumb__item {
    .el-breadcrumb__inner {
      a {
        color: #fff;
      }
    }
    .el-breadcrumb__separator,
    .no-redirect {
      color: rgba(255, 255, 255, 0.5) !important;
    }
  }

  .main-container {
    .navbar {
      background-color: transparent;
      box-shadow: none;
      .el-menu {
        background-color: transparent;
        .el-menu-item {
          &:not(.is-disabled):focus,
          &:not(.is-disabled):hover {
            background-color: rgba(0, 0, 0, 0.05);
          }
        }
        .el-menu-item,
        .el-sub-menu__title {
          color: #fff !important;
        }
        .el-sub-menu__title:hover {
          background-color: rgba(0, 0, 0, 0.05);
        }
      }
    }
  }
}

/** 修改树样式 */
.el-tree-node {
  .el-tree-node__content {
    height: 38px;
  }
  .el-tree-node__label {
    display: flex;
    align-items: center;
    color: #888;
    &:before {
      content: '';
      display: inline-block;
      width: 16px;
      height: 16px;
      background-image: url('@/assets/images/file.svg');
      background-repeat: no-repeat;
      background-size: cover;
      margin-right: 4px;
    }
  }
  .el-tree-node__expand-icon:not(.is-leaf) + .el-tree-node__label {
    color: #000;
    &:before {
      background-image: url('@/assets/images/folder.svg');
    }
  }
}
